<?php
App::uses('CakeEmail', 'Network/Email');
class MessagesController extends AppController{
    
    public $uses = array();
    
    public function send(){
        if(!empty($this->request->data))
        {
            $email = new CakeEmail();
            $email->from(array('jaimeloaizagomez@loaiza.com' => 'jaimeloaizagomez'))
                    ->to($this->request->data['to'])
                    ->subject($this->request->data['subject']);
                    
            if($email->send($this->request->data['message']))
            {
               $this->Session->setFlash(('Email enviado'),
               'default', array('class' => 'success'));
            }
                    
        }
        
        
    }
    
}

